#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int N = 5050;

int n, x, y;
LL dp[N][N];
char a[N], b[N];
int q[N], tt;


/*
贪心+区间dp
1将题目进行化简：距离越远的两个点用y更优，距离越近的两个点用x更优
dp[i][j] 将区间化简得最小花费

dp[i][j] = min(dp[i + 2][j] + calc(i, i + 1), dp[i][j - 2] + clac(j - 1, j), dp[i + 1][j - 1] + calc(i, j));
dp[i][j] = min(dp[i][j], 2 * y * (j - i + ))



比如我们考虑dp[1][8]，如果你从dp[1][4]+dp[5][8]（方案一）转移过来，这样显然是不如dp[1][6]+dp[7][8]（方案二）或dp[1][2]+dp[3][8]（方案三）的
如果方案一比方案二优，则优的部分在5～8，那么这个更优的部分显然会被方案三包括在内，所以我们只需要选择方案二和三即可，而不用考虑从中间截开

*/


void init(){
    for(int i = 0; i <= n; i ++){
        for(int j = 0; j <= n; j ++){
            dp[i][j] = 1e18;
        }
    }
}

LL calc(int i, int j){
    int pos = q[j] - q[i];
    if(pos == 1){
        return min((LL)x, (LL)2 * y);
    }else{
        return min((LL)pos * x, (LL)y);
    }
}

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);

    int T;
    scanf("%d", &T);
    while(T--){
        scanf("%d%d%d", &n, &x, &y);
        scanf("%s%s", a + 1, b + 1);
        init();

        tt = 0;
        for(int i = 1; i <= n; i ++){
            if(a[i] != b[i]){
                q[tt++] = i;
            }
        }

        if(tt % 2){
            printf("-1\n");
            continue;
        }

        for(int len = 2; len <= tt; len += 2){
            for(int l = 0; l + len - 1 < tt; l ++){
                int r = l + len - 1;
                if(len == 2){
                    dp[l][r] = calc(l, r);
                }else{
                    dp[l][r] = min(dp[l + 1][r - 1] + calc(l, r), min(dp[l + 2][r] + calc(l, l + 1), dp[l][r - 2] + calc(r - 1, r)));
                    dp[l][r] = min(dp[l][r], (LL)y * tt / 2);
                }
            }
        }

        printf("%lld\n", dp[0][tt - 1]);
    }
    return 0;
}